<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*
            Math.trunc(num)  把num的小数部分直接舍弃然后返回整数. 如果num是非数值，会先将其转换为数值
            Math.sign(num)  判断num到底是正数负数还是零. 如果num是非数值，会先将其转换为数值
        */

        console.log(Math.trunc(1.8));//1
        console.log(Math.trunc(-1.1));//-1
        console.log(Math.trunc(1));//1
        console.log(Math.trunc('111'));//111
        console.log(Math.trunc('zzz'));//NaN

        console.log('---------------------------------');

        console.log(Math.sign(10));//1
        console.log(Math.sign(-10));//-1
        console.log(Math.sign(0));//0
        console.log(Math.sign('zzz'));//NaN
    </script>

</body>

</html>